home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Help / locale / help / english / sys / eval.doc < prev    next >
Encoding:
Text File  |  2000-10-06  |  1.9 KB  |  109 lines

  1. EVAL
  2.  
  3. Evaluates integer or Boolean expressions.
  4.  
  5. Format
  6.  
  7. EVAL <value1> {[<operation>] [<value2>]} [TO <file>] [LFORMAT=<string>]
  8.  
  9. Template
  10.  
  11. VALUE1/A,OP,VALUE2/M,TO/K,LFORMAT/K
  12.  
  13. Location
  14.  
  15. C:
  16.  
  17. EVAL is used to evaluate and print the answer of an integer expression. The
  18. fractional portion of input values and final results, if any, is truncated
  19. (cut off). If a non-integer is given as an input value, evaluation stops at
  20. the decimal point.
  21.  
  22. <Value1> and <value2> can be decimal (the default), hexadecimal, or octal
  23. numbers. Hexadecimal numbers are indicated by either a leading Ox or #x.
  24. Octal numbers are indicated by either a leading 0 or a leading #.
  25. Alphabetical characters are indicated by a leading single quotation mark (`)
  26. and are evaluated as their ASCII equivalent.
  27.  
  28. The LFORMAT keyword specifies the formatting string used to print the answer.
  29. You can use %X (hexadecimal), %O (octal), %N (decimal), or %C (character).
  30. The %X and %O options require a number of digits using the LFORMAT keyword,
  31. you can specify to print a new line by including *N in your string.
  32.  
  33. The supported operations and their corresponding symbols are shown in the
  34. following table.
  35.  
  36. addition
  37.  
  38. +
  39.  
  40. subtraction
  41.  
  42. -
  43.  
  44. multiplication
  45.  
  46. *
  47.  
  48. division
  49.  
  50. /
  51.  
  52. modulo
  53.  
  54. mod, M, m, or %
  55.  
  56. bitwise AND
  57.  
  58. &
  59.  
  60. bitwise OR
  61.  
  62. |
  63.  
  64. bitwise NOT
  65.  
  66. ~
  67.  
  68. left shift
  69.  
  70. Ish, L, or |
  71.  
  72. right shift
  73.  
  74. rsh, R, or r
  75.  
  76. negation
  77.  
  78. -
  79.  
  80. exclusive OR
  81.  
  82. xor, X, or x
  83.  
  84. bitwise equivalence
  85.  
  86. eqv, E, or e
  87.  
  88. EVAL can be used in scripts as a counter for loops. In that case, use the TO
  89. option to send the output of EVAL to a file.
  90.  
  91. Parentheses can be used in the expressions.
  92.  
  93. Example 1:
  94.  
  95. 1> EVAL 64 / 8 + 2
  96. 10
  97.  
  98. Example 2:
  99.  
  100. 1> EVAL 0x5f / 010 LFORMAT="The answer is %X4*N"
  101. The answer is 000B
  102. 1>
  103.  
  104. This divides hexadecimal 5f (95) by octal 10 (8), yielding 000B, the integer
  105. portion of the decimal answer 11.875. (The 1> prompt appears immediately
  106. after the 000B if *N is not specified in the LFORMAT string.)
  107.  
  108. For more examples using the EVAL command, see Chapter 8.
  109.